<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <title>添加或者修改图像$</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/laypage.css">
    <link rel="stylesheet" href="/layui-util/css/layui.css" media="all">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/jquery.validation/1.14.0/jquery.validate.min.js"></script>
    <script src="/js/jquery.validation/1.14.0/messages_zh.min.js"></script>
    <script src="/js/vue/vue.min.js"></script>
    <script src="/layui-util/layui.js" charset="utf-8"></script>
    <script src="/js/layer/layer.js" charset="utf-8"></script>
</head>
<body>
<script src="/js/webSocket.js"></script>
<section id="container">
<#include "sider.ftl">
    <section id="main-content">
        <section class="wrapper">
            <div class="table-agile-info">
                <div class="panel panel-default">
                    <section class="panel" style="width: 350px;margin: 0 auto">
                        <header class="panel-heading">
                            <h3>修改图像</h3>
                        </header>
                        <div class="layui-upload-list">
                            <img class="layui-upload-img" id="demo1" style="margin-left: 50px" width="240px" src="/Path/${(emp.pic)?default("1540179556713logo.png")}" >
                        </div>
                        <input type="hidden" id="oldPicName" name="oldPicName" value="${(emp.pic)?default("")}"/>
                        <input type="button" class="layui-btn layui-btn-normal" id="test8" value="修改图像" style="margin-left: 30px">
                        <input type="button" class="layui-btn" id="test9" value="确认修改" style="margin-left: 100px">
                    </section>
                </div>
        </section>
        </div>
        </div>
    </section>
     <#include "foot.ftl"><#--引入底部..static/uploadFiles/1538131006032.jpg-->
</section>
</section>
</body>
</html>
<script>
    layui.use('upload', function () {
        var upload = layui.upload;
        upload.render({
            elem: '#test8',
            url: '/emp/addOrUpdatePic',
            auto: false,
            data:{
                oldPicName:$("#oldPicName").val()
            },
            size:1024,
            exts:'png|jpg|gif',
            choose: function (obj) {
                obj.preview(function (index, file, result) {
                    $('#demo1').attr('src', result);
                });
            },
            bindAction: '#test9',
            done: function(){
                window.location.href="/emp/index";
                return layer.msg("上传成功");
            }
            ,error: function(){
                layer.msg("上传失败");
            }
        });
    });
</script>
